var express = require('express');
var router = express.Router();
const mydb = require('./config')
router.get('/list', function(req, res, next) {
	res.send({
		"code": 1,
		data: [{
				id: 1,
				name: 'html'
			},
			{
				id: 2,
				name: 'css'
			},
			{
				id: 3,
				name: 'javascript'
			},
		]
	})
});

router.post('/Article', (req, res) => {
	const sql = "SELECT * from users where id=?"
	mydb.query(sql,1, (err, results) => {

		if (results.length > 0) {
			res.send({
				status: 200,
				results
			})
		} else {
			res.send({
				status: 401,
				msg: '查询失败'
			})
		}



	})
})
module.exports = router;